<table class="kunTable">
	<thead>
    	<th width="20">{{ helper:lang line="global:identifier" }}</th>
        <th width="10"><input type="checkbox" class="checkAll" /></th>
        <th width="70">{{ helper:lang line="global:sort" }}</th>
        <th>{{ helper:lang line="global:title" }}</th>
        <th>{{ helper:lang line="global:date_created" }}</th>
		<th width="50">{{ helper:lang line="global:action" }}</th>
    </thead>
	<tbody>
	{{model}}
			<tr>
            	<td>{{ helper:count identifier }}</td>
                <td><input type="checkbox" class="checkGroup" value="{{id}}" /></td>
                <td>
                	{{ button:href: tag="button" class="save sort" title={helper:lang line="global:save"} data-toggle="tooltip" }}
                 	<input pid="{{id}}" class="inputText medium ordering" type="text" value="{{ordering}}" />
                </td>
                <td>{{frefix}}{{title}}</td>
                <td>{{ helper:date format='d-m-Y H:i' timestamp = created }}</td>
				<td>
					{{button:href: class="edit" title={helper:lang line="global:edit"} data-toggle="tooltip" 
                    		href={url:site uri="admin/page/edit/{{id}}"} }}
                    {{button:href: class="del" title={ helper:lang line="global:delete"} data-toggle="tooltip" 
                    		href={url:site uri="admin/page/delete/{{id}}"} }}
				</td>
            </tr>
	{{/model}}
	</tbody>
</table>

<script type="text/javascript">
$('.sort').click(function(){
	
	$obj = $(this).siblings('input.ordering');
	$id = $obj.attr('pid');
	$value = $obj.val();
	
	$.ajax({
		url:'{{url:site uri="admin/page/ordering"}}',
		data:{id:$id, ordering:$value},
		type:'post',
		success: function(){
			location.reload();
		}
	});
	
	
	return false;
});
</script>